package sxt.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/sxt/LoginChooseServlet")
public class LoginChooseServlet extends BaseServlet {

    private void LoginChoose(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String type = req.getParameter("type");
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        String checkCode = req.getParameter("checkCode");

        /*System.out.println(type+"123");
        System.out.println("user".equals(type));
        System.out.println(type=="user"); 错误锦集1*/

        if ("admin".equals(type)){
            req.getRequestDispatcher("/LoginAdmin").forward(req,resp);
        }else if ("user".equals(type)){
            req.setAttribute("username", username);
            req.setAttribute("password", password);
            req.setAttribute("checkCode", checkCode);
            req.getRequestDispatcher("/Login").forward(req,resp);
        }
    }
}
